home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 823 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.9 KB

  1. Path: news1.h1.usa.pipeline.com!usenet
  2. From: grantp@usa.pipeline.com
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Q: Time to call a function?
  5. Date: 7 Jan 1996 14:46:46 GMT
  6. Organization: Pipeline USA
  7. Message-ID: <4comcm$9fi@news1.usa.pipeline.com>
  8. NNTP-Posting-Host: pipe4.h1.usa.pipeline.com
  9. X-PipeUser: grantp
  10. X-PipeHub: usa.pipeline.com
  11. X-PipeGCOS: (Pete)
  12. X-Newsreader: Pipeline USA v3.3.0
  13.  
  14. On Jan 07, 1996 04:57:51 in article <Q: Time to call a function?>,
  15. 'ez058306@boris.ucdavis.edu (Phillip Geiger)' wrote: 
  16.  
  17.  
  18. >I checked the miscellaneous section of the C-FAQ-list file but didn't see 
  19.  
  20. >this answered covered.... 
  21. >About how much time does calling a function, allocating memory, and  
  22. >executing simple statements like "i = 3" take?  Obviously it depends  
  23. >on how fast the computer running the program is, but I'd like a ball-park 
  24.  
  25. >figure for a 486 or Pentium running a simple program from DOS. 
  26. >Nanoseconds?  Microseconds?  Surely not as slow as a millisecond... (?) 
  27. I have a slightly old book so my figures may be out of date, but for a 
  28. i486: 
  29.  
  30.       Simple function call with no args: 
  31.             INSTR                            CLOCK CYCLES            
  32.            Call instr (Direct intersegment)        20 
  33.            Callee's push bp, etc                     16 
  34.            Simple assignment                           1 
  35.            Intersegment return                       18 
  36.  -------------------------------------------------------------- 
  37.            Total minimum                              55 clock cycles 
  38.  
  39. You can do the arithmetic for you processor speed. 
  40.  
  41. For each argument passed (assuming from memory), add 
  42. 4 clock cycles + setup time, if any; reasonably, you can 
  43. use a total of 6 per argument on the average. 
  44.  
  45. (Sorry if columns don't line up as I'm using a variable pitch 
  46. font editor.) 
  47.             
  48.  
  49. >-- 
  50. >Phil Geiger 
  51. >pggeiger@ucdavis.edu 
  52. -- 
  53.  
  54. Pete
  55.